<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            width: 500px;
            height: 100px;
            border: 2px solid rosybrown;
            text-align: center;
        }
    </style>
    <script>
        function start() {
            var text=document.getElementsByTagName('input')[0].value;
            var obj=document.querySelector('#box');
            obj.innerHTML='';
            var newh2=document.createElement('h2');
            var newtext=document.createTextNode(text);
            newh2.appendChild(newtext);
            obj.appendChild(newh2);
        }
    </script>
</head>
<body>
    <input type="text">&nbsp;
    <button onclick="start()">复制</button>
    <div id="box">    
    </div>

</body>
</html>